package edu.ccut.saturn.manager.css.core;

import java.sql.Connection;
import java.sql.Statement;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnComponentException;

public class UpdateUserCssTheme extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		String userSerialno = (String) parameterContext.getParameterValue(0);
		String cssTheme = (String) parameterContext.getParameterValue(1);
		Connection conn = null;
		Statement st = null;

		if (userSerialno != null && cssTheme != null) {
			String sql = "update user_csskey set csskey = '" + cssTheme
					+ "' where userserialno = '" + userSerialno + "'";

			try {
				conn = parameterContext.getConnection();
				st = conn.createStatement();
				st.executeUpdate(sql);
			} catch (Exception e) {
				throw new SaturnComponentException("update table user_csskey Execption!");
			}
		}
	}
}